/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package music.Chords;

/**
 *
 * @author TJ
 */

public enum ChordQuality {
    MAJOR,MINOR,DIMINISHED,AUGMENTED,HALF_DIMINISHED,DOMINANT;
    public static IntervalQuality getThird(ChordQuality q) {
        switch(q) {
            case MAJOR: return IntervalQuality.MAJOR;
            case MINOR: return IntervalQuality.MINOR;
            case AUGMENTED: return IntervalQuality.MAJOR;
            case DIMINISHED: return IntervalQuality.MINOR;
            case HALF_DIMINISHED: return IntervalQuality.MINOR;
            case DOMINANT: return IntervalQuality.MAJOR;
        }
        return IntervalQuality.NONE;
    }
    public static IntervalQuality getFifth(ChordQuality q) {
        switch(q) {
            case MAJOR: return IntervalQuality.MAJOR;
            case MINOR: return IntervalQuality.MAJOR;
            case AUGMENTED: return IntervalQuality.AUGMENTED;
            case DIMINISHED: return IntervalQuality.DIMINISHED;
            case HALF_DIMINISHED: return IntervalQuality.DIMINISHED;
            case DOMINANT: return IntervalQuality.MAJOR;
        }
        return IntervalQuality.NONE;
    }
    
    public static ChordQuality getQualityFromString(String s){
        if(s.equals("m") || s.toLowerCase().equals("min") || s.equals("-")) {
            return ChordQuality.MINOR;
        } else if(s.equals("+") || s.toLowerCase().equals("aug")) {
            return ChordQuality.AUGMENTED;
        }else if(s.toLowerCase().equals("dom")) {return ChordQuality.DOMINANT;
        }else if(s.equals("o") || s.toLowerCase().equals("dim")) {
            return ChordQuality.DIMINISHED;
        }else if(s.equals("ø")){return ChordQuality.HALF_DIMINISHED;}
        return ChordQuality.MAJOR;}
}
